package sort;

import java.util.Arrays;

//插入排序
public class insertion {
    public static void a(int[] arr){
        int j;
        for (int i = 1; i < arr.length; i++) {
            int cur=arr[i];
            for ( j = i-1; j >=0; j--) {
                if (cur<arr[j]){
                    arr[j+1]=arr[j];
                }else {
                    break;
                }
            }
            arr[j+1]=cur;
        }
        System.out.println(Arrays.toString(arr));
    }
}
